﻿#ifndef BALSERFORM1_H
#define BALSERFORM1_H

#include <QWidget>
#include <pylon/PylonIncludes.h>
#include <pylon/gige/BaslerGigECamera.h>
#include<iostream>
#include <pylon/gige/BaslerGigEInstantCamera.h>
#ifdef PYLON_WIN_BUILD
#include <pylon/PylonGUI.h>
#endif
#include "HalconCpp.h"
#include <QTimer>
#include "data/datasaveread1.h"
#include "ccameraconnectbasler.h"
#include "main/writelog.h"

typedef Pylon::CBaslerGigEInstantCamera Camera_t;
typedef Camera_t::GrabResultPtr_t GrabResultPtr_t;
using namespace Pylon;
using namespace GenApi;

using namespace Halcon;
namespace Ui {
class balserForm1;
}

class balserForm1 : public QWidget
{
    Q_OBJECT

public:
    explicit balserForm1(QString cameraName,QWidget *parent = 0);
    ~balserForm1();
public:
    bool connectCam();
    void grabOneFrame(Hobject *image);
    void setCamPara(int schedule);      //设置相机参数值
    void setUiPara(int schedule);       //设置相机界面类参数
    bool saveData(int cam,int schedule);
    bool readData(int schedule);
    void setProjectName(int camera,QString curProjectName);

private:
    virtual void timerEvent(QTimerEvent *event);
    virtual void closeEvent(QCloseEvent *event);

private slots:
    void on_btngrabOne_clicked();
    void on_btnstop_clicked();
    void on_btngrabContinue_clicked();
    void on_btnOK_clicked();
    void doProSetExpTime(int);
    void doProSetGainRaw(int);

    void on_btnCancel_clicked();

signals:
    void camGrabOneResult(Hobject);

private:
    CcameraConnectBasler *cam;
    QString m_cameraName;
    bool isFindCam  = false;
    int m_timeid;
    Hobject m_matchImage;
    Ui::balserForm1 *ui;
    int m_curCam;                   //当前相机标号
    QString m_curProjectName;  //当前工程名
    camPara m_para;
};

#endif // BALSERFORM1_H
